package com.cx.model;

import com.cx.service.CallService;
import com.cx.service.NetService;
import com.cx.service.SendService;

/**
 * @author zhangshuai
 * @version V1.0
 * @Project Java2_26
 * @Package com.cx
 * @Description:
 * @Date 2025/5/19 18:50
 */

public class MobileCard {
    private String CardNumber;
    private ServicePackage servicePackage;
    private double money;
    private double consumAmount;
    private int realTalkTime;
    private int realSmScount;
    private int realFlow;

    public String getCardNumber() {
        return CardNumber;
    }

    public void setCardNumber(String cardNumber) {
        CardNumber = cardNumber;
    }

    public ServicePackage getServicePackage() {
        return servicePackage;
    }

    public void setServicePackage(ServicePackage servicePackage) {
        this.servicePackage = servicePackage;
    }

    public double getMoney() {
        return money;
    }

    public void setMoney(double money) {
        this.money = money;
    }

    public double getConsumAmount() {
        return consumAmount;
    }

    public void setConsumAmount(double consumAmount) {
        this.consumAmount = consumAmount;
    }

    public int getRealTalkTime() {
        return realTalkTime;
    }

    public void setRealTalkTime(int realTalkTime) {
        this.realTalkTime = realTalkTime;
    }

    public int getRealSmScount() {
        return realSmScount;
    }

    public void setRealSmScount(int realSmScount) {
        this.realSmScount = realSmScount;
    }

    public int getRealFlow() {
        return realFlow;
    }

    public void setRealFlow(int realFlow) {
        this.realFlow = realFlow;
    }

    public MobileCard(String cardNumber, ServicePackage servicePackage, double money) {
        CardNumber = cardNumber;
        this.servicePackage = servicePackage;
        this.money = money;
    }

    public void show(){
        System.out.println("卡号："+ CardNumber + "\t余额"+money+""+"\t消费金额"+consumAmount);
        System.out.println("通话："+ realTalkTime+"\t短信"+realSmScount+"\t流量"+ realFlow * 1024);
        System.out.println("==============套餐=============");
        System.out.println(servicePackage.toString());
    }
    public void send(int count){
        if(servicePackage instanceof SendService){
            SendService servicePackage1 = (SendService) servicePackage;
            servicePackage1.send(count,this);
        }
    }


    public void call(int time) {
        if(servicePackage instanceof CallService){
            CallService servicePackage1 = (CallService) servicePackage;
            servicePackage1.call(time,this);
        }
    }

    public void net(int flow) {
        if(servicePackage instanceof NetService){
            NetService servicePackage1 = (NetService) servicePackage;
            servicePackage1.net(flow,this);
        }
    }
}